package com.hspedu.override_.exercise;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/21
 * @time 19:49
 */
public class OverrideExercise {
    public static void main(String[] args) {
        Person person = new Person("jack",20);
        Student student = new Student("bob",18,1001,100);
        System.out.println(person.say());
        System.out.println(student.say());
    }
}

class Person {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String say() {
        return name + " " + age + " ";
    }
}

class Student extends Person {
    int id;
    private double score;

    public Student(String name, int age, int id, double score) {
        super(name, age);
        this.id = id;
        this.score = score;
    }

    @Override
    public String say() {
        return super.say() + " " + id + " " + score;
    }
}